﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using MayhemWpf.UserControls;

namespace ComputerMayhem.Wpf
{
    /// <summary>
    /// Interaction logic for BatteryConfig.xaml
    /// </summary>
    public partial class BatteryConfig : WpfConfiguration
    {

        public override string Title
        {
            get
            {
                return "Battery Level";
            }
        }

        public int BatteryLevelToMonitor
        {
            get;
            set; 
        }

        public bool Greater
        {
            get;
            set;
        }

        public BatteryConfig(int level, bool greater)
        {
            InitializeComponent();
            BatteryLevelToMonitor = level;
            Greater = greater;

            CanSave = true;
        }

        public override void OnLoad()
        {
            BatterySlider.Value = BatteryLevelToMonitor;
            if (Greater)
            {
                aboveRadioButton.IsChecked = true;
            }
            else
            {
                belowRadioButton.IsChecked = true;
            }
        }

        public override void OnSave()
        {

            BatteryLevelToMonitor = (int) BatterySlider.Value;

            Greater = (bool)aboveRadioButton.IsChecked;
        }

    }
}
